package com.of.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.of.pojo.Role;
import com.of.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface RoleMapper extends BaseMapper<Role> {
    @Select("SELECT COUNT(1) FROM role")
    long findTotal();

    List<User> findRoleList(@Param("start") int start, @Param("size") int size, @Param("query") String query);
    @Update("update role set status=#{status}," +
            "updated=#{updated} where id=#{id}")
    void updateStatus(Role role);

    @Update("update role set name=#{name},duty=#{duty},sort_num=#{sortNum},updated=#{updated} where id=#{id}")
    void updateRole(Role role);
    @Select("select * from role where id=#{id}")
    Role findRoleById(Integer id);
}
